import type * as T from './type'
import http from '@/utils/http'
// @ts-ignore
export type * from './type'
import type {LabelValueState} from "@/types/global";
const BASE_URL = '/system/broadcastCategory'

/** @desc 查询列表 */
export function listCategory(query: T.CategoryQuery) {
  return http.get<T.CategoryDto[]>(`${BASE_URL}/list`, query)
}

/** @desc 查询列表 */
export function selectCategory() {
  return http.get<LabelValueState[]>(`${BASE_URL}/getSelectList`)
}



/** @desc 查询详情 */
export function getCategory(id: string) {
  return http.get<T.CategoryDto>(`${BASE_URL}/getData/${id}`)
}

/** @desc 新增 */
export function addCategory(data: any) {
  return http.post<boolean>(`${BASE_URL}/create`, data)
}

/** @desc 修改 */
export function updateCategory(data: any) {
  return http.post(`${BASE_URL}/modify`, data)
}

/** @desc 删除 */
export function deleteCategory(id: string) {
  return http.del(`${BASE_URL}/delete/${id}`)
}

/** @desc 导出 */
export function exportCategory(query: T.CategoryQuery) {
  return http.download(`${BASE_URL}/export`, query)
}
